<?php
$form = $this->beginWidget ( 'bootstrap.widgets.TbActiveForm', array (
		'id' => 'team-form',
		'enableAjaxValidation' => false,
		'htmlOptions' => array (
				'enctype' => 'multipart/form-data' 
		) 
) );
?>

<p class="help-block">
	Campos com <span class="required">*</span> são obrigatórios.
</p>

<?php echo $form->errorSummary($model); ?>

<?php if($model->id == null || $model->id == 0) {?>

<span class="span4">
			<?php echo "<br/><h5>Foto *</h5>"; ?>
		</span>
<!-- Anexa Arquivos -->
<?php echo $this->renderPartial('/file/_form', array('form'=>$form, 'formats'=>'jpg|jpeg|png|gif', 'images'=>$foto, 'filename'=>'foto', 'size'=> 1));?>
<?php 
if(!$hasPhoto) {
	echo '<span class="span7"  style="color: #b94a48;">Foto é obrigatória</span>';
}
?>

<?php } ?>
<span class="span4">
		<?php echo $form->textFieldRow($model,'name',array('class'=>'span4','maxlength'=>250)); ?>
	</span>
<span class="span4">
		<?php echo $form->textFieldRow($model,'official_name',array('class'=>'span5','maxlength'=>250)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'state',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'city',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span2">
	<?php echo $form->textFieldRow($model,'country',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span5">
	<?php echo $form->textFieldRow($model,'street',array('class'=>'span5','maxlength'=>250)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'number',array('class'=>'span2','maxlength'=>8)); ?>
	</span>
<span class="span6">
	<?php echo $form->textFieldRow($model,'complement',array('class'=>'span6','maxlength'=>250)); ?>
	</span>
<span class="span2">
	<?php echo $form->textFieldRow($model,'neighborhood',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'cep',array('class'=>'span3','maxlength'=>8)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'phone',array('class'=>'span3','maxlength'=>15)); ?>
	</span>
<span class="span2">
	<?php echo $form->textFieldRow($model,'fax',array('class'=>'span3','maxlength'=>15)); ?>
	</span>
<span class="span7">
	<?php echo $form->textFieldRow($model,'email',array('class'=>'span7','maxlength'=>250)); ?>
	</span>
<span class="span7">
	<?php echo $form->textFieldRow($model,'site',array('class'=>'span7','maxlength'=>250)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'cnpjl',array('class'=>'span3','maxlength'=>14)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'federation',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span2">
	<?php echo $form->textFieldRow($model,'mandato',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'agency',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span3">
	<?php echo $form->textFieldRow($model,'account',array('class'=>'span3','maxlength'=>45)); ?>
	</span>
<span class="span2">
	<?php echo $form->textFieldRow($model,'bank',array('class'=>'span3','maxlength'=>45)); ?>
	</span>

<span class="span7">
	<?php echo "<br/><h5>Contatos *</h5>"; ?>
	</span>
<!-- Cadastra contatos -->
<?php echo $this->renderPartial('/contact/_form', array('form'=>$form,'team'=>$model, 'contacts'=>$contacts, 'hasContact'=>$hasContact));?>
	
<span class="span7">
			<?php echo "<br/><h5>Anexar Arquivos *</h5>"; ?>
		</span>
<!-- Anexa Arquivos -->
<?php echo $this->renderPartial('/file/_form', array('form'=>$form, 'formats'=>$formats, 'images'=>$images, 'filename'=>'filenames', 'size'=> 5));?>

<?php 
if(!$hasFiles) {
	echo '<span class="span7"  style="color: #b94a48;">Nenhum arquivo inserido</span>';
}
?>


<span class="span9">
	<div class="form-actions" align="center">
		<?php
		$this->widget ( 'bootstrap.widgets.TbButton', array (
				'buttonType' => 'submit',
				'type' => 'primary',
				'label' => $model->isNewRecord ? 'Cadastrar' : 'Salvar' 
		)
		// 'htmlOptions' => array( 'class' =>'span3'),
		 );
		?>
	</div>
</span>
<?php $this->endWidget(); ?>
